double ** make_list(double data[], int sizes[]) {
    double **mat=new double*[20];
    int count = 0;
    for(int i = 0; i<20;i++){
        if(sizes[i]==0) {
            mat[i]= NULL;
            break;
        }
        mat[i]=new double[sizes[i]];
        for(int j = 0;j<sizes[i];j++){
            mat[i][j]=data[count];
            count++;
        }
    }
    return mat;
}

void free_lists(double * lists[]) {
    for(int i = 0;;++i){
        if (lists[i] == NULL) break;
        delete [] lists[i];
    }
    delete [] lists;
}

